package cn.wizzer.app.crown.modules.models.enums;

import cn.wizzer.framework.util.Result;
import org.apache.commons.lang.math.RandomUtils;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 足球具体玩法枚举
 */
public enum BetsEnum {
    // 全场波胆
    FULL_PD("Full Time",2),
    // 半场波胆
    HALF_PD("Half Time",1),
    // 全场入球
    FULL_GOALS("Score",3),
    ;
    final public String NAME;
    final public int VALUE;

    BetsEnum(String name, int val) {
        NAME = name;
        VALUE = val;
    }

    public String getBetName() {
        return NAME;
    }

    public int getBetValue() {
        return VALUE;
    }

    public static List<Map<Object, Object>> toList(){
        BetsEnum[] values = BetsEnum.values();
        return Arrays.stream(values).map(enu -> Result.createHashMap("name", enu.NAME, "value", enu.toString()))
                .collect(Collectors.toList());
    }

    public static BetsEnum randomEnum() {
        return values()[RandomUtils.nextInt(values().length)];
    }
}

